package com.fh.controller.app.voice;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fh.controller.base.BaseController;
import com.fh.entity.Page;
import com.fh.service.sk.banner.BannerService;
import com.fh.service.sk.production.ProductionService;
import com.fh.util.AppUtil;
import com.fh.util.PageData;

@Controller
@RequestMapping(value="/appSK")
public class TheWorks extends BaseController{

	@Resource(name="productionService")
	private ProductionService productionService;
	
	@Resource(name="bannerService")
	private BannerService bannerService;
	
	/**
	 * 获取作品Banner数据
	 */
	@RequestMapping(value="/getRightBannerData")
	@ResponseBody
	public Object getRightBannerData(Page page){
		List<PageData> varList = new ArrayList<PageData>();
		Map<Object,Object> map = new HashMap<Object,Object>();
		logBefore(logger, "获取作品banner数据");
		PageData pd = new PageData();
		pd = this.getPageData();
		try {
			varList = productionService.list(page);	//列出production列表
		} catch (Exception e){
			logger.error(e.toString(), e);
		}finally{
			map.put("result", "01");
			map.put("data", varList);
			logAfter(logger);
		}
		return AppUtil.returnObject(pd, map);
	}
	
	/**
	 * 获取作品数据
	 */
	@RequestMapping(value="/getProductionData")
	@ResponseBody
	public Object getProductionData(Page page){
		List<PageData> varList = new ArrayList<PageData>();
		Map<Object,Object> map = new HashMap<Object,Object>();
		logBefore(logger, "获取作品数据");
		PageData pd = new PageData();
		pd = this.getPageData();
		try {
			varList = bannerService.list(page);	//列出production列表
		} catch (Exception e){
			logger.error(e.toString(), e);
		}finally{
			map.put("result", "01");
			map.put("data", varList);
			logAfter(logger);
		}
		return AppUtil.returnObject(pd, map);
	}
}
